home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / processes / sharedmemory / sharedmemory.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-06  |  1.8 KB  |  51 lines

  1. /*
  2.     File:        SharedMemory.h
  3.  
  4.     Contains:    A sample to demonstrate Shared Memory using shmget()
  5.  
  6.     Written by:     Karl Groethe
  7.  
  8.     Copyright:    Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.             You may incorporate this Apple sample source code into your program(s) without
  11.             restriction. This Apple sample source code has been provided "AS IS" and the
  12.             responsibility for its operation is yours. You are not permitted to redistribute
  13.             this Apple sample source code as "Apple sample source code" after having made
  14.             changes. If you're going to re-distribute the source, we require that you make
  15.             it clear in the source that the code was descended from Apple sample source
  16.             code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                         8/16/00        Created
  20. */
  21. #import <AppKit/AppKit.h>
  22. #include <semaphore.h>
  23.  
  24. @interface SharedMemory : NSObject
  25. {
  26.     //interface elements
  27.     NSTextField* AttachTime;
  28.     NSTextField* ChangeTime;
  29.     NSButton* AttachDetach;
  30.     NSTextField* Creator;
  31.     NSTextView* Data;
  32.     NSTextField* DetachTime;
  33.     NSTextField* Key;
  34.     NSTextField* NumberOfAttaches;
  35.     NSTextField* Operator;
  36.     NSTextField* BlockSize;
  37.     NSButton*    StartStopButton;
  38.     
  39.     //data elements
  40.     char* SharedMemoryBlock;    //a character pointer to our data block
  41.     int SharedMemID;        //the ID given to our shared memory segment by Shmget
  42.     sem_t* SemaphoreID;        //A semaphore to protect the shared memory while we read or write
  43. }
  44. -(void)AttachDetach:(id)sender;     //called when the Create/Attach or Detach button is clicked
  45. -(void)StartStopEditing:(id)sender;    //called when the Start or Stop Editing button is clicked
  46. -(void)FinishedUpdate:(id)anObject;    //called when our update thread completes so we can spin off another
  47. -(id)init;
  48. -(void)dealloc;
  49.  
  50. @end
  51.